let list = [
  {
    id: 1,
    postName: '首席运营师',
    postCode: 'CET',
    order: 32,
    status: '1',
    remark: 'New York No. 1 Lake Park',
  },
]

export default {
  'GET  /api/v1/post': {
    data: list,
    total: list.length,
    page: 1,
    success: true
  },
  'POST /api/v1/post/': async (req: Request, res: Response) => {
    const { postName, postCode, order, status, remark } = req.body as any;

    list.push({
      id: list.length + 1,
      postName,
      postCode,
      order,
      status,
      remark,
    })
    res.send({
      success: true
    });
  },
  'PUT /api/v1/post/1': async (req: Request, res: Response) => {
    const { postName, postCode, order, status, remark } = req.body as any;

    const one = list.find(l => l.id === 1)
    if (one) {
      one.postName = postName
      one.postCode = postCode
      one.order = order
      one.status = status
      one.remark = remark

    }
    res.send({
      success: true,
      one
    });
  },
  'DELETE /api/v1/post/1': async (req: Request, res: Response) => {

    list = list.filter((l) => l.id != 1)
    res.send({
      success: true,
    });
  },
};

